package dlally.controller;

import java.awt.event.MouseEvent;

import dlally.model.DecisionLinesEvent;
import dlally.model.Edge;
import dlally.view.GameFieldGUI;
import junit.framework.TestCase;
/**
 * Tests the construction and all the methods in the EdgeController
 * @author Douglas Lally (dlally@wpi.edu)
 *
 */
public class testEdgeController extends TestCase {
	
	/**
	 * This test will require a model, gui, edge controller, and a mouse event to construct the edge controller
	 */
	DecisionLinesEvent model;
	GameFieldGUI gui;
	EdgeController eControl;
	MouseEvent me;

	/**
	 * Set up the model, gui, create a dummy mouse event, and then construct an edge controller
	 * Note that the second argument to the mouseevent constructor is supposed to be a Unique ID generated by a mouse click,
	 * the documentation warns that any other integer value there could cause unexpected behavior. My testing seems to have worked when I ran it, but your results may vary
	 */
	protected void setUp() throws Exception {
		super.setUp();
		model = new DecisionLinesEvent(3,3);
		gui = new GameFieldGUI(model);
		gui.setVisible(true);
		me = new MouseEvent(gui.getPanel(), 50, System.nanoTime(), 0, 150, 0, 1, false);
		eControl = new EdgeController(gui, model, me);
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}
	/**
	 * Thorougly test the process method, and the printResultsToConsole (which happens if the event is done)
	 */
	public void testProcess(){
		model.addEdge(new Edge(0,1,10));
		model.addEdge(new Edge(0,1,20));
		model.addEdge(new Edge(0,1,30));
		model.addEdge(new Edge(0,1,40));
		model.addEdge(new Edge(0,1,50));
		model.addEdge(new Edge(0,1,60));
		model.addEdge(new Edge(0,1,70));
		model.addEdge(new Edge(0,1,80));
		eControl.process();

	}
	

}
